package myJs.tool

import myJs.Utils._
import myJs.myPkg.jquery._
import org.scalajs.dom.{Element, Event, document}
import scalatags.Text.all
import scalatags.Text.all._

/**
 * Created by yz on 28/5/2020
 */
trait TableFilterTool {

  def clickHide = {
    $(document).on("click", (y: Element, e: Event) => {
      val trueY = e.target.asInstanceOf[Element]
      val b = $(trueY).hasClass("select2-selection__choice__remove") ||
        $(trueY).hasClass("select2-search__field") ||
        $(trueY).hasClass("filterContent") ||
        $(trueY).parents().hasClass("filterContent")
      if (!b) {
        $(".filterContent").hide()
      }
    })
  }

  def getFilterDataFieldName(jq: JQuery) = {
    jq.attr("filter-data-field").get
  }

  def getFilterDataFieldName(y: Element) = {
    $(y).attr("filter-data-field").get
  }


}
